<%@ page language="java" import="dao.*" pageEncoding="UTF-8" %>
 <%@ page language="java" import="java.util.*" %>
 <%@page import="util.*" %>
 <%@ include file="head.jsp" %>

<script src="js/jquery.validate.js"></script>
<script>
    window.searchSelectUrl = "ajax.jsp?a=selectUpdate";
    window.selectUpdateUrl = "ajax.jsp?a=table";
</script>
<script src="js/selectUpdate.js"></script>

<div style="padding: 10px" class="admin-content">
    <% if (request.getSession().getAttribute("username") == null || "".equals(request.getSession().getAttribute("username"))) { %>

    <script>
        alert("对不起,请您先登陆!");
        location.href = "login.jsp";
    </script>
    <%return;
    } %> <%
     String updtself = "0"; // 设置更新
     HashMap mmm = new CommDAO().getmap(request.getParameter("id"), "xueshengchengji");
     %>


    <div class="container">
        <!-- 使用bootstrap css框架，container定宽，并剧中 https://v3.bootcss.com/css/#overview-container -->

        <div class="panel panel-default">
            <div class="panel-heading">编辑学生成绩:</div>
            <div class="panel-body">
                <form action="xueshengchengji.jsp?a=update" method="post" name="form1" id="form1">
                    <!-- form 标签开始 -->

                    <input type="hidden" name="kechengxinxiid" value="<%= mmm.get("kechengxinxiid") %>" />
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">课程编号</label>
                            <div class="col-sm-10"><%= mmm.get("kechengbianhao") %><input type="hidden" id="kechengbianhao" name="kechengbianhao" value="<%= Info.html(mmm.get("kechengbianhao")) %>" /></div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">课程名称</label>
                            <div class="col-sm-10"><%= mmm.get("kechengmingcheng") %><input type="hidden" id="kechengmingcheng" name="kechengmingcheng" value="<%= Info.html(mmm.get("kechengmingcheng")) %>" /></div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">科目</label>
                            <div class="col-sm-10"><% Map mapkemuxinxi56 = new CommDAO().find("SELECT kemumingcheng,id FROM kemuxinxi where id='" + mmm.get("kemu") + "'"); %>
<%= mapkemuxinxi56.get("kemumingcheng") %><input type="hidden" id="kemu" name="kemu" value="<%= Info.html(mmm.get("kemu")) %>" /></div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">学分</label>
                            <div class="col-sm-10"><%= mmm.get("xuefen") %><input type="hidden" id="xuefen" name="xuefen" value="<%= Info.html(mmm.get("xuefen")) %>" /></div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">学生</label>
                            <div class="col-sm-10">
                                <div class="form-inline">
                                    <select
                                        class="form-control"
                                        data-fields="xuehao,xingming,xueqi,banji"
                                        data-value="<%= Info.html(mmm.get("xuesheng")) %>"
                                        id="xuesheng"
                                        name="xuesheng"
                                        onchange="getAjaxData('xueshengxinxi',this,this.value)"
                                    >
                                        <option value="">请选择学生</option>
                                    </select>
                                    关键词：<input type="text" class="form-control" id="xuesheng_keyword" value="" />
                                    <select class="form-control class_xueqi_search46" data-value="" id="xueqi_search" name="xueqi_search">
                                        <option value="">请选择</option>
                                        <% List<Map> select = new CommDAO().select("SELECT * FROM xueqixinxi ORDER BY id desc"); %>
 <% for (Map m : select) { %>

                                        <option value="<%= m.get("id") %>"><%= m.get("xueqimingcheng") %></option>
                                        <%} %>

                                    </select>
                                    <select class="form-control class_banji_search47" data-value="" id="banji_search" name="banji_search">
                                        <option value="">请选择</option>
                                        <% select = new CommDAO().select("SELECT * FROM banjixinxi ORDER BY id desc"); %>
 <% for (Map m : select) { %>

                                        <option value="<%= m.get("id") %>"><%= m.get("banjimingcheng") %></option>
                                        <%} %>

                                    </select>
                                    <button type="button" class="btn btn-default" onclick="xuesheng_select_update()">搜索</button>
                                    <script>
                                        function xuesheng_select_update() {
                                            var keyword = $("#xuesheng_keyword").val();
                                            var where = {};
                                            if ($("#xueqi_search").val() != "") where.xueqi = $("#xueqi_search").val();
                                            if ($("#banji_search").val() != "") where.banji = $("#banji_search").val();
                                            searchSelect("xuesheng", "xueshengxinxi", keyword, where, "xuehao,xingming,xueqi,banji".split(","), "".split(","));
                                        }
                                        xuesheng_select_update();
                                    </script>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">学号</label>
                            <div class="col-sm-10">
                                <input
                                    type="text"
                                    class="form-control select-update"
                                    placeholder="输入学号"
                                    style="width: 150px"
                                    readonly="readonly"
                                    id="xuehao"
                                    name="xuehao"
                                    value="<%= mmm.get("xuehao") %>"
                                />
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">姓名</label>
                            <div class="col-sm-10">
                                <input
                                    type="text"
                                    class="form-control select-update"
                                    placeholder="输入姓名"
                                    style="width: 150px"
                                    id="xingming"
                                    name="xingming"
                                    value="<%= Info.html(mmm.get("xingming")) %>"
                                />
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">学期</label>
                            <div class="col-sm-10">
                                <select class="form-control select-update" data-value="<%= Info.html(mmm.get("xueqi")) %>" id="xueqi" name="xueqi" style="width: 250px">
                                    <% select = new CommDAO().select("SELECT * FROM xueqixinxi ORDER BY id desc"); %>
 <% for (Map m : select) { %>

                                    <option value="<%= m.get("id") %>"><%= m.get("xueqimingcheng") %></option>
                                    <%} %>

                                </select>
                                <script>
                                    $(".class_xueqi48 select-update").val($(".class_xueqi48 select-update").attr("data-value"));
                                </script>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">班级</label>
                            <div class="col-sm-10">
                                <select class="form-control select-update" data-value="<%= Info.html(mmm.get("banji")) %>" id="banji" name="banji" style="width: 250px">
                                    <% select = new CommDAO().select("SELECT * FROM banjixinxi ORDER BY id desc"); %>
 <% for (Map m : select) { %>

                                    <option value="<%= m.get("id") %>"><%= m.get("banjimingcheng") %></option>
                                    <%} %>

                                </select>
                                <script>
                                    $(".class_banji49 select-update").val($(".class_banji49 select-update").attr("data-value"));
                                </script>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">成绩<span style="color: red">*</span></label>
                            <div class="col-sm-10">
                                <input
                                    type="number"
                                    class="form-control"
                                    placeholder="输入成绩"
                                    style="width: 150px"
                                    data-rule-required="true"
                                    data-msg-required="请填写成绩"
                                    number="true"
                                    data-msg-number="输入一个有效数字"
                                    id="chengji"
                                    name="chengji"
                                    value="<%= Info.html(mmm.get("chengji")) %>"
                                />
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">评语</label>
                            <div class="col-sm-10">
                                <textarea style="width: 80%; height: 120px" class="form-control" placeholder="输入评语" id="pingyu" name="pingyu"><%= Info.html(mmm.get("pingyu")) %></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs">教师</label>
                            <div class="col-sm-10">
                                <input
                                    type="text"
                                    class="form-control"
                                    placeholder="输入教师"
                                    style="width: 150px"
                                    readonly="readonly"
                                    id="jiaoshi"
                                    name="jiaoshi"
                                    value="<%= mmm.get("jiaoshi") %>"
                                />
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="row">
                            <label style="text-align: right" class="col-sm-2 hiddex-xs"> </label>
                            <div class="col-sm-10">
                                <input name="id" value="<%= mmm.get("id") %>" type="hidden" />
                                <input name="referer" value="<%=request.getHeader("referer") %>" type="hidden" />
                                <input name="updtself" value="<%= updtself %>" type="hidden" />

                                <button type="submit" class="btn btn-primary" name="Submit">提交</button>
                                <button type="reset" class="btn btn-default" name="Submit2">重置</button>
                            </div>
                        </div>
                    </div>

                    <!--form标签结束-->
                </form>
            </div>
        </div>

        <!-- container定宽，并剧中结束 -->
    </div>

    <script>
        $(function () {
            $("#form1").validate();
        });
    </script>
</div>
<%@ include file="foot.jsp" %>

